import apis from '@/api/apis.js'

export default {
	namespaced: true,
	state: {
		pageNum: 1,
		pageSize: 10,
		godl: [],
		code: ``

	},
	mutations: {

		//拿去所有黄金
		setgodl(state, newData) {
			console.log(newData)
			state.godl = newData
		},
		//获取黄金信息
		sethj(state, newdata) {
			state.code = newdata
		}
	},
	actions: {
		//黄金列表
		async getgold(context) {
			let data = await apis.manager.getgold({
				pageNum: 1,
				pageSize: 200
			})
			context.commit(`setgodl`, data)
		},
		//获取所有
		async getGoldmsg(context, code) {
			const data = await apis.manager.goldMessage(code)
			return data
		},
		async goldHostprice(context, code) {
			const msg = await apis.manager.goldHostprice(code)
			return msg
		}
	}
}